<?php

namespace app\admin\model\yexam;

use think\Model;

class ComboList extends Model
{
    //================  手动指定表名
    protected $name = 'yexam_combo_list';
    protected $autoWriteTimestamp = 'int';
    protected $dateFormat = 'Y-m-d H:i:s';
    // 格式化套餐标签
    protected function getComboTagsAttr($val)
    {
        return $val;
        $result = explode(',',str_replace("\r\n",',',$val));
        halt($result);
        $str = '';
        foreach ($result as $key => $value)
        {
            $str .='<p style="color: red;display: inline;background-color: #0a4b3e;">'.$value.'</p>';
        }
        return $str;
    }
    //============= 一对一关联
    public function comboCategory()
    {
        return $this->hasOne('combo_category','category_id','id')
            ->field('category_name,category_id')/*->bind('category_name')*/;
    }
}